function randomBackground() {
  var randombg = $(".randombg");
  randombg.each(function(){
    var x = 18;
    var y = 0;
    var rand = parseInt(Math.random() * (x - y + 1) + y);
    $(this).addClass("bgc"+rand);
  });
}

$(function() {
    randomBackground();
});

$(function() {
  var articleItemBgClass = '';

  $('.ripple-article-item-block').on('click', function () {
    var $this = $(this);

    $this.attr('class').split(' ').forEach(function (_class) {
      if (_class.indexOf('bgc') > -1 ) {
        articleItemBgClass = _class;
      }
    });
  });
  $('#modal-ripple-article').on('show.bs.modal', function () {
    $(this).find('.randombg')
      .attr('class', 'ripple-article-item-block randombg ' + articleItemBgClass);
  });
});
